package planesimulator.plane.wing;


import planesimulator.plane.wing.coefficients.LiftCoefficient;
import planesimulator.plane.wing.coefficients.DragCoefficient;
import com.jme.math.Vector3f;
import planesimulator.plane.AbstractPlane;

/**
 * Abstract class representing any wing on the plane.
 * @author Jakub Klimek
 */
public abstract class Wing {
  /**  Name in the plane*/
  public String name;
  
  /** Wing area*/
  protected float size;
  
  /** Object representing aircraft. */
  protected AbstractPlane wing_plane;
  
  /** Wing lift coefficient */
  protected LiftCoefficient lift_coeff;
  
  /** Wing drag coefficient */
  protected DragCoefficient drag_coeff;
  
  /** Vector from wing center to plane COG*/
  public Vector3f position;
  
  /** Wing's angle of attack */
  public float angle_of_attack = 0;

  /**
   * 
   * @param n Name
   * @param size Area of the wing.
   * @param p Object representing aircraft.
   * @param lc Wing lift coefficient.
   * @param dc Wing dragcoefficient.
   * @param position Vector from position of wing to plane's COG.
   */
  public Wing(
      String n,
      float size,
      AbstractPlane p,
      LiftCoefficient lc, 
      DragCoefficient dc,
      Vector3f position) {
    name = n;
    wing_plane = p;
    lift_coeff = lc;
    drag_coeff = dc;
    this.position = position;
    this.size = size;
  }

  /**
   * 
   * @param force Force vector to by updated with force generated by wing.
   */
  abstract public void calculateForceOnWing(Vector3f force);

  /**
   * 
   * @param force Force vector to by updated with force generated by wing.
   * @param torque Torque vector to by updated with torque generated by wing.
   */
  abstract public void calculateForcesOnWing(Vector3f force, Vector3f torque);
}